home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / mkmf / RCS / mkmf.biglib,v < prev    next >
Encoding:
Text File  |  1991-04-11  |  13.5 KB  |  745 lines

  1. head     1.25;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @@;
  7.  
  8.  
  9. 1.25
  10. date     91.04.11.12.53.23;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.24;
  13.  
  14. 1.24
  15. date     89.10.09.21.27.33;  author rab;  state Exp;
  16. branches ;
  17. next     1.23;
  18.  
  19. 1.23
  20. date     89.08.24.21.49.03;  author douglis;  state Exp;
  21. branches ;
  22. next     1.22;
  23.  
  24. 1.22
  25. date     89.08.18.11.21.22;  author douglis;  state Exp;
  26. branches ;
  27. next     1.21;
  28.  
  29. 1.21
  30. date     89.08.17.11.14.40;  author douglis;  state Exp;
  31. branches ;
  32. next     1.20;
  33.  
  34. 1.20
  35. date     89.04.06.21.40.09;  author jhh;  state Exp;
  36. branches ;
  37. next     1.19;
  38.  
  39. 1.19
  40. date     88.12.31.14.44.56;  author ouster;  state Exp;
  41. branches ;
  42. next     1.18;
  43.  
  44. 1.18
  45. date     88.11.27.16.28.11;  author ouster;  state Exp;
  46. branches ;
  47. next     1.17;
  48.  
  49. 1.17
  50. date     88.08.20.12.58.20;  author ouster;  state Exp;
  51. branches ;
  52. next     1.16;
  53.  
  54. 1.16
  55. date     88.08.12.14.38.23;  author ouster;  state Exp;
  56. branches ;
  57. next     1.15;
  58.  
  59. 1.15
  60. date     88.07.21.11.34.57;  author douglis;  state Exp;
  61. branches ;
  62. next     1.14;
  63.  
  64. 1.14
  65. date     88.07.20.10.22.09;  author ouster;  state Exp;
  66. branches ;
  67. next     1.13;
  68.  
  69. 1.13
  70. date     88.07.02.14.33.53;  author ouster;  state Exp;
  71. branches ;
  72. next     1.12;
  73.  
  74. 1.12
  75. date     88.06.29.14.31.29;  author ouster;  state Exp;
  76. branches ;
  77. next     1.11;
  78.  
  79. 1.11
  80. date     88.06.29.14.30.07;  author ouster;  state Exp;
  81. branches ;
  82. next     1.10;
  83.  
  84. 1.10
  85. date     88.06.27.09.56.35;  author ouster;  state Exp;
  86. branches ;
  87. next     1.9;
  88.  
  89. 1.9
  90. date     88.06.17.16.27.37;  author ouster;  state Exp;
  91. branches ;
  92. next     1.8;
  93.  
  94. 1.8
  95. date     88.06.17.13.59.48;  author ouster;  state Exp;
  96. branches ;
  97. next     1.7;
  98.  
  99. 1.7
  100. date     88.06.17.09.00.42;  author ouster;  state Exp;
  101. branches ;
  102. next     1.6;
  103.  
  104. 1.6
  105. date     88.06.17.08.51.02;  author ouster;  state Exp;
  106. branches ;
  107. next     1.5;
  108.  
  109. 1.5
  110. date     88.06.16.09.37.27;  author ouster;  state Exp;
  111. branches ;
  112. next     1.4;
  113.  
  114. 1.4
  115. date     88.06.06.08.37.01;  author ouster;  state Exp;
  116. branches ;
  117. next     1.3;
  118.  
  119. 1.3
  120. date     88.06.05.11.38.59;  author ouster;  state Exp;
  121. branches ;
  122. next     1.2;
  123.  
  124. 1.2
  125. date     88.04.28.17.41.44;  author ouster;  state Exp;
  126. branches ;
  127. next     1.1;
  128.  
  129. 1.1
  130. date     88.04.28.09.45.25;  author ouster;  state Exp;
  131. branches ;
  132. next     ;
  133.  
  134.  
  135. desc
  136. @@
  137.  
  138.  
  139. 1.25
  140. log
  141. @Flush DEFTARGET: the default target is now determined by a pmake
  142. library file.
  143. @
  144. text
  145. @#!/sprite/cmds/csh -f
  146. #
  147. # A script to generate (or regenerate) a library directory  Makefile
  148. # from a prototype Makefile.  If ./Makefile.proto exists, use it, else
  149. # use a common prototype.  This script is invoked for libraries that
  150. # have their sources distributed among a number of subdirectories;  this
  151. # script is invoked in the subdirectories.
  152. #
  153. # We assume we were invoked from mkmf.  Parameters passed in from mkmf
  154. # through environment variables:
  155. #
  156. #    DOMACHINES    names of machines we are supposed to run mkmf on
  157. #    MKMFDIR        directory containing prototype makefiles
  158. #    MKMFFLAGS    arguments to all mkmfs run recursively
  159. #    MACHINES    list of machine names (e.g. "sun2 sun3"), for
  160. #            which there are machine-dependent subdirectories
  161. #            (sun3.md, spur.md, etc.) of this directory.
  162. #    MAKEFILE    name of makefile to create
  163. #    SUBTYPE        information about what type of library this is:
  164. #            used to figure out where to install things.
  165. #
  166.  
  167. #
  168. # Argument processing.  (Generalized form, even though just one flag so far.)
  169. #
  170. while ($#argv >= 1)
  171.     if ("$1" == '-x') then
  172.     set echo
  173.     endif
  174.     shift
  175. end
  176.  
  177. set subtype=$SUBTYPE
  178. set lib=$cwd:h
  179. set lib=$lib:t
  180. set subdir=$cwd:t
  181. set pref='[a-z_A-Z]'
  182. set machines=($MACHINES)
  183. set domachines = ($DOMACHINES)
  184. set makefile=$MAKEFILE
  185. set distdir=($DISTDIR)
  186.  
  187. if (-e $makefile.proto) then
  188.     set proto=$makefile.proto
  189. else
  190.     set proto="${MKMFDIR}/Makefile.biglib"
  191. endif
  192.  
  193. echo "Generating $makefile for library subdirectory $lib/$cwd:t using $proto"
  194.  
  195. set nonomatch
  196. set hdrs =( ${subdir}*.h )
  197. if ("$hdrs" == "${subdir}*.h") set hdrs=()
  198. set pubHdrs=(`echo $hdrs | sed -e "s/[^ ]*Int.h//g"`)
  199. set allSrcs =( ${pref}*.[cylsp] )
  200. #
  201. # Check to see if there were any sources.  The first check (size == 1)
  202. # is only necessary because the second check will cause an error if
  203. # allSrcs contains more than 1024 bytes.
  204. #
  205. if ($#allSrcs == 1) then
  206.     if ("$allSrcs" == "${pref}*.[cylsp]") set allSrcs=()
  207. endif
  208. set mdSrcs =( *.md/${pref}*.[cylsp] )
  209. if ($#mdSrcs == 1) then
  210.     if ("$mdSrcs" == "*.md/${pref}*.[cylsp]") set mdSrcs=()
  211. endif
  212. set allSrcs=($allSrcs $mdSrcs)
  213. set lints = ( *.lint )
  214. if ("$lints" == "*.lint") set lints=()
  215. set manPages = (*.man)
  216. if ("$manPages" == "*.man") set manPages=()
  217.  
  218. #
  219. # Use sed to substitute various interesting things into the prototype
  220. # makefile. The code below is a bit tricky because some of the variables
  221. # being substituted in can be very long:  if the substitution is passed
  222. # to sed with "-e", the entire variable must fit in a single shell argument,
  223. # with a limit of 1024 characters.  By generating a separate script file
  224. # for the very long variables, the variables get passed through (to the
  225. # script file) as many arguments, which gets around the length problem.
  226. #
  227.  
  228. rm -f mkmf.tmp.sed
  229. echo s,"@@(ALLSRCS)",$allSrcs,g > mkmf.tmp.sed
  230. echo s,"@@(MANPAGES)",$manPages,g > mkmf.tmp.sed2
  231. cat $proto | sed -f mkmf.tmp.sed -f mkmf.tmp.sed2 \
  232.     -e "s,@@(DATE),`date`,g" \
  233.     -e "s,@@(LINTSRCS),$lints,g" \
  234.     -e "s,@@(MACHINES),$machines,g" \
  235.     -e "s,@@(MAKEFILE),$makefile,g" \
  236.     -e "s,@@(MANPAGES),$manPages,g" \
  237.     -e "s,@@(NAME),$lib,g" \
  238.     -e "s,@@(PUBHDRS),$pubHdrs,g" \
  239.     -e "s,@@(SUBDIR),$subdir,g" \
  240.     -e "s,@@(TEMPLATE),$proto,g" \
  241.     -e "s,@@(TYPE),$subtype,g" \
  242.     -e "s,@@(DISTDIR),$distdir,g" \
  243.     > $makefile
  244. rm -f mkmf.tmp.sed mkmf.tmp.sed2
  245.  
  246. setenv PARENTDIR $cwd
  247. foreach i ($domachines)
  248.     (cd $i.md; mkmf $MKMFFLAGS -f md.mk)
  249. end
  250. @
  251.  
  252.  
  253. 1.24
  254. log
  255. @Modifications for distribution.
  256. @
  257. text
  258. @a11 1
  259. #    DEFTARGET    name of default target
  260. a40 1
  261. set defTarget=($DEFTARGET)
  262. a88 1
  263.     -e "s,@@(DEFTARGET),${defTarget:q},g" \
  264. @
  265.  
  266.  
  267. 1.23
  268. log
  269. @fixed typo
  270. @
  271. text
  272. @d43 1
  273. d101 1
  274. @
  275.  
  276.  
  277. 1.22
  278. log
  279. @another change for TM -- use single machine if it exists, else \ds3100
  280. @
  281. text
  282. @d90 1
  283. a90 1
  284.     -e "s,@@(DEFTARGET),$ {defTarget:q},g" \
  285. @
  286.  
  287.  
  288. 1.21
  289. log
  290. @removed DEFTARGET -- we use $MACHINE now
  291. @
  292. text
  293. @d12 1
  294. d42 1
  295. d90 1
  296. @
  297.  
  298.  
  299. 1.20
  300. log
  301. @added abilty to make specific machine types
  302. @
  303. text
  304. @a11 1
  305. #    DEFTARGET    name of default target
  306. a40 1
  307. set defTarget=($DEFTARGET)
  308. a87 1
  309.     -e "s,@@(DEFTARGET),$defTarget,g" \
  310. @
  311.  
  312.  
  313. 1.19
  314. log
  315. @Use TYPE instead of INSTALLDIR, INSTALLMAN, etc.
  316. @
  317. text
  318. @d12 2
  319. d40 1
  320. d42 1
  321. a51 6
  322. if (" $machines " =~ *\ sun3\ *) then
  323.     set defTarget=sun3
  324. else
  325.     set defTarget=$machines[1]
  326. endif
  327.  
  328. d103 2
  329. a104 1
  330. foreach i ($machines)
  331. @
  332.  
  333.  
  334. 1.18
  335. log
  336. @Various changes to replace old C library entirely with new C library.
  337. @
  338. text
  339. @a35 13
  340. switch ($subtype)
  341.     case sprite:
  342.     set includedir=/sprite/lib/include
  343.     set installman=/sprite/doc/ref/lib/$lib
  344.     breaksw
  345.     case x:
  346.     set includedir=/X/lib/include
  347.     set installman=/X/doc/ref/lib/$lib
  348.     breaksw
  349.     default:
  350.     echo Unknown library subtype "$subtype"
  351.     exit 1
  352. endsw
  353. a92 2
  354.     -e "s,@@(INCLUDEDIR),$includedir,g" \
  355.     -e "s,@@(INSTALLMAN),$installman,g" \
  356. d101 1
  357. @
  358.  
  359.  
  360. 1.17
  361. log
  362. @Add x subtype.
  363. @
  364. text
  365. @a20 19
  366. # Variables generated here:
  367. #    includedir    place where public header files get installed
  368. #    lib        base library name to create (directories are assumed
  369. #            to be named after the libraries they create):
  370. #            c, tcl, sx, etc.  This is actually the name of the
  371. #            parent directory.
  372. #    lints        list of ".lint" files;  these are dummy .c files
  373. #            that supply lint information for assembler procedures
  374. #            that lint cannot process.
  375. #    machines    list of machines for which we can target:  needed
  376. #            because env variables can't always be used where
  377. #            variables can.
  378. #    makefile    name of the makefile to create
  379. #    pref        prefix pattern that files must match to be included
  380. #    proto        name of prototype makefile to use to create $makefile
  381. #    pubHdrs        list of header files that this directory exports to
  382. #            the rest of the world.
  383. #    subdir        name of this directory (the sub-piece of the library)
  384. #
  385. d33 3
  386. d38 2
  387. a39 1
  388.     set includedir=/sprite/lib/include.new
  389. d42 2
  390. a43 1
  391.     set includedir=/a/X/lib/include
  392. a48 3
  393. set lib=$cwd:h
  394. set lib=$lib:t
  395. set subdir=$cwd:t
  396. d87 2
  397. d102 3
  398. a104 4
  399. cat $proto | sed -f mkmf.tmp.sed \
  400.     -e "s,@@(LIBRARY),$lib,g" \
  401.     -e "s,@@(SUBDIR),$subdir,g" \
  402.     -e "s,@@(MACHINES),$machines,g" \
  403. d107 1
  404. a107 1
  405.     -e "s,@@(PUBHDRS),$pubHdrs,g" \
  406. d109 1
  407. d111 4
  408. a115 1
  409.     -e "s,@@(DATE),`date`,g" \
  410. d117 1
  411. a117 1
  412. rm -f mkmf.tmp.sed
  413. @
  414.  
  415.  
  416. 1.16
  417. log
  418. @No need to look for MAKEFILE or MACHINES.  Also, be more restrictive
  419. on which headers are exported.
  420. @
  421. text
  422. @d56 3
  423. @
  424.  
  425.  
  426. 1.15
  427. log
  428. @added ability to turn on echoing for all mkmf's invoked.
  429. @
  430. text
  431. @d18 1
  432. a18 1
  433. #    TYPE        information about what type of library this is:
  434. a38 1
  435. #    type        type of makefile to make (e.g. att, src, local, etc.)
  436. d51 2
  437. a52 4
  438.  
  439.  
  440. set type=$TYPE
  441. switch ($type)
  442. d57 1
  443. a57 1
  444.     echo Unknown library type "$type"
  445. a63 5
  446.  
  447. if ($?MACHINES == 0) then
  448.     echo "No target machines for $lib/$cwd:t"
  449.     exit 1
  450. endif
  451. d65 1
  452. a65 4
  453. if ("$machines" == "") then
  454.     echo "No target machines for $lib/$cwd:t"
  455.     exit 1
  456. endif
  457. a66 6
  458. if ($?MAKEFILE) then
  459.     set makefile=$MAKEFILE
  460. else
  461.     set makefile=Makefile
  462. endif
  463.  
  464. d82 2
  465. a83 2
  466. set hdrs =( ${pref}*.h )
  467. if ("$hdrs" == "${pref}*.h") set hdrs=()
  468. a130 2
  469.  
  470. pmake dependall
  471. @
  472.  
  473.  
  474. 1.14
  475. log
  476. @Add code to be more careful about long lists of source files.
  477. @
  478. text
  479. @d13 1
  480. d42 12
  481. d146 1
  482. a146 1
  483.     (cd $i.md; mkmf -f md.mk)
  484. @
  485.  
  486.  
  487. 1.13
  488. log
  489. @Better support for lint, and for dummy lint files (*.lint).
  490. @
  491. text
  492. @d90 13
  493. a102 4
  494. if ("$allSrcs" == "${pref}*.[cylsp]") set allSrcs=()
  495. set mdsrcs =( *.md/${pref}*.[cylsp] )
  496. if ("$mdsrcs" == "*.md/${pref}*.[cylsp]") set mdsrcs=()
  497. set allSrcs=($allSrcs $mdsrcs)
  498. @
  499.  
  500.  
  501. 1.12
  502. log
  503. @Didn't quite get last change right.
  504. @
  505. text
  506. @d21 1
  507. a21 1
  508. #    type        type of makefile to make (e.g. att, src, local, etc.)
  509. d24 5
  510. a28 4
  511. #            c, tcl, sx, etc.
  512. #    pref        prefix pattern that files must match to be included
  513. #    makefile    name of the makefile to create
  514. #    proto        name of prototype makefile to use to create $makefile
  515. d32 7
  516. d52 1
  517. d94 2
  518. d111 1
  519. d116 1
  520. @
  521.  
  522.  
  523. 1.11
  524. log
  525. @Had bad error message for missing .md directories.
  526. @
  527. text
  528. @d47 1
  529. a47 1
  530.     echo "No target machines for $lib"
  531. d52 1
  532. a52 1
  533.     echo "No target machines for $lib"
  534. @
  535.  
  536.  
  537. 1.10
  538. log
  539. @Add "type" field to map, pass it through to individual mkmf.*
  540. scripts so they don't have to do their own path-name analysis.
  541. @
  542. text
  543. @d47 1
  544. a47 1
  545.     echo "No target machines for $prog"
  546. d52 1
  547. a52 1
  548.     echo "No target machines for $prog"
  549. @
  550.  
  551.  
  552. 1.9
  553. log
  554. @Changes to handle directories with many many files.
  555. @
  556. text
  557. @d17 2
  558. d32 2
  559. a33 1
  560. set type=`expr $cwd : '/[^/]*/\([^/]*\)/.*'`
  561. d35 1
  562. a35 1
  563.     case src:
  564. a37 6
  565.     case att:
  566.     set includedir=/att/lib/include
  567.     breaksw
  568.     case local:
  569.     set includedir=/local/lib/include
  570.     breaksw
  571. d39 1
  572. a39 1
  573.     echo Don\'t know how to mkmf this library
  574. @
  575.  
  576.  
  577. 1.8
  578. log
  579. @For now, install headers in include.new.
  580. @
  581. text
  582. @d89 13
  583. a101 1
  584. cat $proto | sed \
  585. a104 1
  586.     -e "s,@@(ALLSRCS), $allSrcs,g" \
  587. d111 1
  588. @
  589.  
  590.  
  591. 1.7
  592. log
  593. @Change default Makefile from Makefile.libc.srcDir to Makefile.biglib.
  594. @
  595. text
  596. @d33 1
  597. a33 1
  598.     set includedir=/sprite/lib/include/new
  599. @
  600.  
  601.  
  602. 1.6
  603. log
  604. @Generate "ALLSRCS".
  605. @
  606. text
  607. @d68 1
  608. a68 1
  609.     set proto="${MKMFDIR}/Makefile.libc.srcDir"
  610. @
  611.  
  612.  
  613. 1.5
  614. log
  615. @Minor editorial cleanup;  no functional changes.
  616. @
  617. text
  618. @d83 5
  619. d93 1
  620. @
  621.  
  622.  
  623. 1.4
  624. log
  625. @Print out actual name of makefile when it's different from "Makefile".
  626. @
  627. text
  628. @d4 1
  629. a4 1
  630. # from the prototype Makefile.  If ./Makefile.proto exists, use it, else
  631. d14 1
  632. a14 1
  633. #            which there are machine-specific subdirectories
  634. d26 3
  635. a28 2
  636. #    machines    list of machines for which we can target:  corresponds
  637. #            to .md directories in the PARENT of this directory.
  638. d36 1
  639. a36 1
  640.     set includedir=/sprite/att/lib/include
  641. d39 1
  642. a39 1
  643.     set includedir=/sprite/local/lib/include
  644. d95 1
  645. a95 1
  646. foreach i ($MACHINES)
  647. @
  648.  
  649.  
  650. 1.3
  651. log
  652. @Various revisions to generate Makefiles for multi-directory
  653. libraries with multiple target machines.
  654. @
  655. text
  656. @d70 1
  657. a70 1
  658. echo "Generating a Makefile for library subdirectory $lib/$cwd:t using $proto"
  659. @
  660.  
  661.  
  662. 1.2
  663. log
  664. @New mkmf stuff for new library area.
  665. @
  666. text
  667. @d9 2
  668. a10 3
  669. # We assume we were invoked from mkmf, thus we don't need to alter the
  670. # path, and MKMFDIR is in the environment to tell us where to find prototype
  671. # makefiles, etc.
  672. d12 7
  673. a18 1
  674. # Variables:
  675. d25 3
  676. a27 4
  677. #    MKMFDIR        directory containing prototype makefiles
  678. #    MACHINES    list of machines for which machine-specific
  679. #            directories exist in the parent directory (passed
  680. #            from mkmf as an environment variable)
  681. a31 1
  682.     set lintdir=/sprite/lib/lint
  683. a34 1
  684.     set lintdir=/sprite/att/lib/lint
  685. a37 1
  686.     set lintdir=/sprite/local/lib/lint
  687. d48 10
  688. d72 4
  689. a75 28
  690. #
  691. # First figure out what's there by way of .c, .y, .l, .s, .p, .h and .o files
  692. # If any one doesn't have any members, it'll contain the original
  693. # pattern (b/c of nonomatch). We want it to be empty, though, so
  694. # we reset it.
  695. #
  696. set nonomatch
  697. set srcs=( ${pref}*.[cylsp] )
  698. if ("$srcs" == "${pref}*.[cylsp]") set srcs=()
  699. set Hfiles=( ${pref}*.h )
  700. if ("$Hfiles" == "${pref}*.h") set Hfiles=()
  701. rm -f version.o
  702. set Ofiles=( ${pref}*.o )
  703. if ("$Ofiles" == "${pref}*.o") set Ofiles=()
  704. unset nonomatch
  705.  
  706. #
  707. # Merge in any .o files that can be created from local source files but don't
  708. # exist yet. In addition, figure out which .o files may be safely removed
  709. # during a "make clean" and store them in RmOfiles.
  710. #
  711. set RmOfiles=""
  712. if ("$srcs" != "") then
  713.     foreach file ($srcs)
  714.         set file=$file:r.o
  715.         set RmOfiles=($RmOfiles $file)
  716.         if (! -e $file) set Ofiles=($Ofiles $file)
  717.     end
  718. d78 4
  719. a81 1
  720. set PubHfiles=(`echo $Hfiles | sed -e "s/${pref}*Int\.h//g"`)
  721. a82 2
  722. if (-e $makefile) mv $makefile $makefile.$$~
  723.  
  724. d85 2
  725. a86 6
  726.     -e "s,@@(OBJS),$Ofiles,g" \
  727.     -e "s,@@(CLEANOBJS),$RmOfiles,g" \
  728.     -e "s,@@(SRCS),$srcs,g" \
  729.     -e "s,@@(HDRS),$Hfiles,g" \
  730.     -e "s,@@(PUBHDRS),$PubHfiles,g" \
  731.     -e "s,@@(LINTDIR),$lintdir,g" \
  732. d88 2
  733. a91 1
  734.     -e "s,@@(MAKEFILE),$makefile,g" \
  735. d93 6
  736. @
  737.  
  738.  
  739. 1.1
  740. log
  741. @Initial revision
  742. @
  743. text
  744. @@
  745.